class SimpleMailer < ActionMailer::Base

  def new_file(group, user, upload, teaching, host)
    @subject    = "#{group.name} has just marked a file as final"
    @recipients = "\"#{teaching.user.name}\" <#{teaching.user.email}>"
    @from       = "\"#{user.name}\" <#{user.email}>"
    @body['group'] = group
    @body['user'] = user
    @body['upload'] = upload
    @body['teaching'] = teaching
    @body['host'] = host
  end

  def new_user(group, user, teaching, host)
    @subject    = "#{user.name} has just joined your group"
    @recipients = "\"#{group.owner.name}\" <#{group.owner.email}>"
    @from       = "\"#{user.name}\" <#{user.email}>"
    @body['group'] = group
    @body['user'] = user
    @body['teaching'] = teaching
    @body['host'] = host
  end

  def new_note(group, users, upload, teaching, host)
    @subject    = "#{teaching.user.name} has just changed the notes on a file"
    @from       = "\"#{teaching.user.name}\" <#{teaching.user.email}>"
    @recipients = users.map {|user| "\"#{user.name}\" <#{user.email}>"}.join(', ')
    @body['group'] = group
    @body['upload'] = upload
    @body['teaching'] = teaching
    @body['host'] = host
  end
end
